package com.cencus.service.impl;

import com.cencus.dao.PhotoDao;
import com.cencus.domain.Photo;
import com.cencus.service.PhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class PhotoServiceImpl implements PhotoService {

    @Autowired
    private PhotoDao photoDao;

    @Override
    @Transactional
    public void savePhoto(Photo photo) {
        photoDao.insert(photo);
    }

    @Override
    public List<Photo> getAllPhotos() {
        return photoDao.selectList(null);
    }
}
